<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>忘记密码</title>
    <link rel="stylesheet" href="css/base.css" />
    <link rel="stylesheet" href="css/iconfont.css" />
    <link rel="stylesheet" href="css/forget-password.css" />
    <link rel="stylesheet" href="css/login.css" />
    <link rel="stylesheet" href="css/register.css" />
    <link rel="stylesheet" href="css/all.css" />
</head>
<body>
<div>
    <div>
         <span href="javascript:;" onclick="go()">
        <i class="iconfont icon-iconfontjiantou1"></i></span>
    </div>
    <div class="head-photo">
        <img src="img/touxiang.png" alt="">
    </div>
    <div class="cell">
        <i>+86</i>
        <input type="text" placeholder="请输入手机号" class="resetUpwd-input" id="forgetPassword-userName"/>
    </div>   
    <div class="cell">
        <input type="text" placeholder="请输入验证码" class="resetUpwd-inputs" id="forgetPassword-Code"/>
        <input type="button " value="获取验证码" class="verity">
    </div>
    <div class="cell">
        <input type="text" placeholder="请输入新密码" class="resetUpwd-input" id="forgetPassword-password"/>
    </div>
    <div class="cell">
        <input type="text" placeholder="请再次输入密码" class="resetUpwd-input" id="forgetPassword-newpassword"/>
    </div>
 
    <div class="cells-one">
        <i></i>
        <span>我已同意蒲公英计划相关</span><span>注册服务条款</span>
    </div>
    <input type="button" value="确定" class="resetUpwd" />
</div>
<script src="js/jquery.js"></script>
<script src="js/x_rem.js"></script>
<script src="js/all.js"></script>
<script>
	$(".verity").click(function(){
		var that = $(this);
		if(vali($("#forgetPassword-userName"), /^1[0-9]{10}$/, "请输入正确的手机号")){
			var data={
				mobilePhone : $("#forgetPassword-userName").val()
			};
			
			var success=(data)=>{
				count(that);
			};
			 
			Hajax("post","/user/doCode",data,success);
		}
		
		
	});
	
	
	
	
	$(".resetUpwd").click(()=>{
	 	if(!vali($("#forgetPassword-userName"), /^1[0-9]{10}$/, "请输入正确的手机号")){
	 		
	 	}else if($("#forgetPassword-Code").val()==""){
	 		popup("验证码不能为空");
	 	}else if(!vali($("#forgetPassword-password"),/^[a-zA-Z0-9_]{6}$/,"请输入6位字母或数字")){
	 		
	 	}else if($("#forgetPassword-password").val()!=$("#forgetPassword-newpassword").val()){
	 		popup("两次密码不一致");
	 	}else{
	 		var data={
	 			userName:$("#forgetPassword-userName").val(),
	 			password:$("#forgetPassword-Code").val(),
	 			newCode:$("#forgetPassword-password").val()
	 		};
	 		
	 		var success=(data)=>{
	 			popup(data.message);
	 		};
	 		
	 		Hajax("post","/user/updatePassword2",data,success);
	 		
	 		
	 	}
		
		
		
		
		
	});
	
	
	
	
</script>
</body>
</html>